import request from './request'

/**
 * 获取所有词书列表
 */
export const getWordbookList = () => {
  return request.get('/admin/wordbooks')
}

/**
 * 获取词书详情
 */
export const getWordbookById = (id) => {
  return request.get(`/admin/wordbooks/${id}`)
}

/**
 * 创建词书
 */
export const createWordbook = (data) => {
  return request.post('/admin/wordbooks', data)
}

/**
 * 更新词书
 */
export const updateWordbook = (id, data) => {
  return request.put(`/admin/wordbooks/${id}`, data)
}

/**
 * 删除词书
 */
export const deleteWordbook = (id) => {
  return request.delete(`/admin/wordbooks/${id}`)
}

/**
 * 获取词书的单词列表
 */
export const getWordbookWords = (id) => {
  return request.get(`/admin/wordbooks/${id}/words`)
}

/**
 * 从词书中移除单词
 */
export const removeWordFromWordbook = (wordbookId, wordId) => {
  return request.delete(`/admin/wordbooks/${wordbookId}/words/${wordId}`)
}

